package com.wgf.controller;

import cn.hutool.core.date.DateTime;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.deepseek.DeepSeekChatModel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DeepSeekController {

    @Resource
    private DeepSeekChatModel deepSeekChatModel;

    @Resource
    private ChatModel chatModel;

    //http://localhost:6001/chat
    @GetMapping("/chat")
    public String chat(@RequestParam(name = "question",defaultValue = "你是谁") String question)
    {
        String result = deepSeekChatModel.call(question);
        System.out.println("chat result:" + result);
        return DateTime.now().toString()+"<br> \t"+result;
    }

    //http://localhost:6001/chat1
    @GetMapping("/chat1")
    public String chat1(@RequestParam(name = "question",defaultValue = "中国的首都是哪个城市") String question)
    {
        String result = chatModel.call(question);
        System.out.println(result);
        return result;
    }
}
